package src.java.easy;

public class Solution657 {
    public boolean judgeCircle(String moves) {
        int[] arr = {0, 0};
        for (char c : moves.toCharArray()) {
            if (c == 'U') {
                arr[1]--;
            } else if (c == 'D') {
                arr[1]++;
            }
            if (c == 'R') {
                arr[0]--;
            } else if (c == 'L') {
                arr[0]++;
            }
        }
        return arr[0] == 0 && arr[1] == 0;
    }
}
